<?php
$_SESSION['destination'] = $_SERVER['REQUEST_URI'];
echo <<< START
<div class="container">
<link href="/afctf/css/announce.css" rel="stylesheet" type="text/css" media="all"/>
	<div class="layui-elem-field main">
		<h1 style="margin-top:10px">公告</h1>
		<div class="layui-field-box">
START;
?>
<?php	
$query = "SELECT * FROM `announcement` ORDER BY `time` DESC";
$sth = $dbh -> prepare($query);
$sth -> execute();
$rownum = $sth->rowCount();
for($i = 0;$i < $rownum; $i++ ){
	$result = $sth -> fetch();
	$title = $result['title'];
	$time	= $result['time'];
	$time 	= "公告发布于： ".$time;
	$content= $result['content'];
	echo <<<EOT
		<hr>
		<div class="block">
			<h2>$title</h2>
			<div id="time_block">
				<time>$time</time>
			</div>
			<div id="content_block">
				<p>$content</p>
			</div>
		</div>
EOT;
}
?>
<?php
echo <<< END
		</div>
	</div>
<script type="text/javascript" src="/afctf/layui/layui.all.js"></script>
</div>
END;
?>